/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package EntidadesDBPrueba;

import java.io.Serializable;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Facundo
 */
@Entity
@Table(name = "barrio", catalog = "tpare", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Barrio.findAll", query = "SELECT b FROM Barrio b"),
    @NamedQuery(name = "Barrio.findByNombreBarrio", query = "SELECT b FROM Barrio b WHERE b.barrioPK.nombreBarrio = :nombreBarrio"),
    @NamedQuery(name = "Barrio.findByNombreLocalidad", query = "SELECT b FROM Barrio b WHERE b.barrioPK.nombreLocalidad = :nombreLocalidad"),
    @NamedQuery(name = "Barrio.findByNombreProvincia", query = "SELECT b FROM Barrio b WHERE b.barrioPK.nombreProvincia = :nombreProvincia")})
public class Barrio implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected BarrioPK barrioPK;

    public Barrio() {
    }

    public Barrio(BarrioPK barrioPK) {
        this.barrioPK = barrioPK;
    }

    public Barrio(String nombreBarrio, String nombreLocalidad, String nombreProvincia) {
        this.barrioPK = new BarrioPK(nombreBarrio, nombreLocalidad, nombreProvincia);
    }

    public BarrioPK getBarrioPK() {
        return barrioPK;
    }

    public void setBarrioPK(BarrioPK barrioPK) {
        this.barrioPK = barrioPK;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (barrioPK != null ? barrioPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Barrio)) {
            return false;
        }
        Barrio other = (Barrio) object;
        if ((this.barrioPK == null && other.barrioPK != null) || (this.barrioPK != null && !this.barrioPK.equals(other.barrioPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "EntidadesDBPrueba.Barrio[ barrioPK=" + barrioPK + " ]";
    }
    
}
